//
//  WZTabbarSubCell.swift
//  WZApp
//
//  Created by evol on 2018/6/12.
//  Copyright © 2018年 evol. All rights reserved.
//

import UIKit

class ELTabbarSubCell: UICollectionViewCell {
    
    var model = ELTabbarSubModel(){
        didSet {
            label.text = model.title
            pitchOn = model.selected
        }
    }
    
    var pitchOn = false {
        didSet {
            if pitchOn {
                label.textColor = UIColor.hexColor("#89bfa1")
            }else{
                label.textColor = .white
            }
        }
    }
    
    var label:UILabel! = {
        let label = UILabel()
        label.textColor = .white
        label.font = UIFont.systemFont(ofSize: 16.0)
        return label
    }()
    
    var point:UIView! = {
        let point = UIView()
        point.backgroundColor = .white
        return point
    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        let layoutView = UIView()
        contentView.addSubview(layoutView)
        layoutView.snp.makeConstraints { (make) in
            make.edges.equalTo(contentView)
            make.height.equalTo(tabbarHeight)
        }
        
        layoutView.addSubview(label)
        label.snp.makeConstraints { (make) in
            make.left.equalTo(15)
            make.right.equalTo(-15)
            make.centerY.equalTo(layoutView)
        }
        
        layoutView.addSubview(point)
        point.snp.makeConstraints { (make) in
            make.width.height.equalTo(2)
            make.centerY.equalTo(layoutView)
            make.right.equalTo(layoutView)
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
